package project.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import project.Pojo.Appointment;
import project.Pojo.Result;
import project.Service.Impl.AppointmentServiceImpl;

@RestController
public class AppointmentController {

    @Autowired
    AppointmentServiceImpl appointmentService;

    @PostMapping("/submitappointmnet")
    public Result submitappointmnet(@RequestBody Appointment appointment) {
        System.out.println(appointment.toString());
        boolean flag = appointmentService.insertAppointment(appointment);
        if (flag == true) {
            return new Result(200, "预约成功", null);
        } else {
            return new Result(404, "预约失败", null);
        }
    }
}
